package com.example.demo.enums;


import lombok.Getter;


@Getter
public enum ActionTypeEnum {

    SEND_KEYS_ACTION("sendKeys", 0),
    SUBMIT_ACTION("submit", 1),
    CLICK_ACTION("click", 2),
    CLEAR_ACTION("clear", 3),
    GET_TEXT_ACTION("getText",4),
    IMPLICITLY_WAIT_ACTION("implicitlyWait",5),
    QUIT_ACTION("quit",6),
    SAVE_SCREENSHOT_ACTION("saveScreenshot",7),
    GET_ACTION("get",8);


    private String name;
    private int value;

    ActionTypeEnum(String name, int value) {
        this.name = name;
        this.value = value;
    }

    /**
     * int类型转换成枚举类型
     *
     * @param value 对应枚举的int 类型
     * @return 返回枚举数据
     */

    public static ActionTypeEnum valueOfType(int value) {
        switch (value) {
            case 0:
                return SEND_KEYS_ACTION;
            case 1:
                return SUBMIT_ACTION;
            case 2:
                return CLICK_ACTION;
            case 3:
                return CLEAR_ACTION;
            case 4:
                return GET_TEXT_ACTION;
            case 5:
                return IMPLICITLY_WAIT_ACTION;
            case 6:
                return QUIT_ACTION;
            case 7:
                return SAVE_SCREENSHOT_ACTION;
            default:
                return null;
        }
    }


}
